package main

import (
	log2 "dh.com/shop/common/wrapper/log"
	"dh.com/shop/srv/product/handler"
	"github.com/micro/go-micro"
	"github.com/micro/go-micro/util/log"

	product "dh.com/shop/srv/product/proto/product"
)

func main() {
	// New Service
	service := micro.NewService(
		micro.Name("com.dh.shop.srv.product"),
		micro.Version("1.0"),
	)

	// Initialise service
	service.Init(
		micro.WrapHandler(log2.LogWrapper(service.Client())),
	)

	// Register Handler
	product.RegisterProductHandler(service.Server(), new(handler.Product))

	// Run service
	if err := service.Run(); err != nil {
		log.Fatal(err)
	}
}
